<template>

  <div style="width: 100%;">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm" size="mini" :inline="true">
      <el-form-item label="产品名称：" prop="name">
        <el-input v-model="ruleForm.name " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="抽查理由：" prop="reasons">
        <el-input v-model="ruleForm.reasons " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="抽查批次：" prop="batch">
        <el-input v-model="ruleForm.batch " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="每批次抽样数量：" prop="number">
        <el-input v-model="ruleForm.number " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="实施年份：" prop="year">
        <el-input v-model="ruleForm.year " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="实施批次：" prop="batches">
        <el-input v-model="ruleForm.batches " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="其他类别：" prop="other">
        <el-input v-model="ruleForm.other " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="抽查实施细则：" prop="details">
        <el-input v-model="ruleForm.details " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="授权证书有效期：" prop="authorization">
        <el-input v-model="ruleForm.authorization " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="计量认证有效期：" prop="metering">
        <el-input v-model="ruleForm.metering " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="实验室认可有效期：" prop="laboratory">
        <el-input v-model="ruleForm.laboratory " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="上报检验结果时间：" prop="test">
        <el-input v-model="ruleForm.test " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="申报经费预算：" prop="budget">
        <el-input v-model="ruleForm.budget " clearable style="width: 220px"></el-input>
      </el-form-item>
      <el-form-item label="抽查企业：" prop="enterprise">
        <el-input v-model="ruleForm.enterprise " clearable style="width: 220px"></el-input>
      </el-form-item>
    </el-form>
    <div align="center">
      <el-button type="primary" size="small" @click="submitForm('ruleForm')">确认</el-button>
      <el-button type="primary" size="small" @click="backPrePage">返回</el-button>
    </div>
  </div>
</template>
<script>

  export default {
    data () {
      return {
        ruleForm: {},
        rules:{},
        rows:''
      };
    },
    mounted() {

      // console.log(this.$route.query.rows)
      this.rows = this.$route.query.rows
      this.ruleForm = this.$store.state.taskList[this.rows]

    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            let data = {
              "index":this.rows,
              "list":this.ruleForm
            };
            this.$store.commit('edit_task_list',data);
            this.$router.push({path:'/task'})
          } else {
            return false;
          }
        });
      },
      backPrePage() {
        // carStore.commit('delete_tabs',this.$route.fullPath);
        this.$router.back()
      }
    }
  }
</script>

